import Vue from 'vue'
import Vuex from 'vuex'
import user from '@/store/modules/user'
import common from '@/store/modules/common'
import createPersistedstate from 'vuex-persistedstate'

Vue.use(Vuex)

export default new Vuex.Store({
  //分模块配置
  modules:{user,common},
  //持久化配置
  plugins:[
    createPersistedstate({
      //存储方式 localStorage、sessionStorage、cookies
      storage: window.sessionStorage,
      //存储在localStoreger中的KEY
      key:'sky',
      //要对那些模块进行持久化存储
      paths:['user','common']
    })
  ]
})
